﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;

namespace ConversionInterface
{
    public class MKVInfo
    {
        private List<MediaFile> mediaFiles = new List<MediaFile>();

        public MKVInfo(string filename)
        {
            FileInfo file = new FileInfo(filename);
            if(!file.Exists)
                throw new ArgumentException(filename + " does not exist");

            ProcessStartInfo startInfo = new ProcessStartInfo("mkvinfo.exe", "maidguy.mkv");
            startInfo.RedirectStandardError = true;
            startInfo.RedirectStandardInput = true;
            startInfo.RedirectStandardOutput = true;
            startInfo.CreateNoWindow = true;
            startInfo.UseShellExecute = false;
            Process process = new Process();

            process.StartInfo = startInfo;
            process.EnableRaisingEvents = true;

            if (process.Start())
            {
                StreamReader error = process.StandardError;
                StreamReader output = process.StandardOutput;
                StreamWriter input = process.StandardInput;
                ParseResults(output.ReadToEnd());
            }
        }

        private void ParseResults(string results)
        {
            
                
        }

        public List<MediaFile> MediaFiles
        {
            get { return mediaFiles; }
        }
    }
}
